package com.littleken.foodieMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.littleken.foodiePojo.domain.ItemsDO;
import com.littleken.foodiePojo.vo.ItemCommentVO;
import com.littleken.foodiePojo.vo.SearchItemsVO;
import com.littleken.foodiePojo.vo.ShopcartVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface ItemsMapper extends BaseMapper<ItemsDO> {

    /**
     * 根据商品id和评价等级查评价
     * @param map itemId level
     * @return
     */
    List<ItemCommentVO> getItemComments(@Param("paramsMap") Map<String, Object> map);

    List<SearchItemsVO> searchItems(@Param("paramsMap") Map<String, Object> map);

    List<SearchItemsVO> searchItemsByThirdCat(@Param("paramsMap") Map<String, Object> map);

    List<ShopcartVO> queryItemsBySpecIds(@Param("paramsList") List specIdsList);

    int decreaseItemSpecStock(@Param("specId") String specId,
                              @Param("pendingCounts") int pendingCounts);

}